package cn.edu.zzuli.springcloud.controller;

import cn.edu.zzuli.springcloud.entities.CommonResult;
import cn.edu.zzuli.springcloud.entities.Payment;
import cn.edu.zzuli.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
        log.info("consumer get payment ...");
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/consumer/payment/timeout")
    public String timoutTest() {
        return paymentFeignService.getPaymentTimeout();
    }

}
